package main

import (
	"github.com/spf13/viper"
	"time"
)

type Mysql struct {
	Username string
	Password string
}
type Conf struct {
	Mysql Mysql
}

func main() {
	confPath := "./conf"
	viper.SetConfigType("yaml")
	viper.SetConfigName("conf.yaml")
	viper.AddConfigPath(confPath)
	if err := viper.ReadInConfig(); err != nil {
		panic(err)
	}
	m := new(Conf)
	if err := viper.Unmarshal(m); err != nil {
		panic(err)
	}

	println(m.Mysql.Username)
	for true {
		time.Sleep(time.Second)
		println(time.Now().String())
	}
}
